home *** CD-ROM | disk | FTP | other *** search
- Path: news.uiowa.edu!usenet
- From: larued@crpl.cedar-rapids.lib.ia.us
- Newsgroups: comp.lang.c++
- Subject: Re: Argument from commandline???
- Date: 1 Feb 1996 00:53:20 GMT
- Organization: University of Iowa, Iowa City, IA, USA
- Distribution: world
- Message-ID: <4ep2u0$nho@flood.weeg.uiowa.edu>
- References: <4eou36$p6g@prometheus.algonet.se>
- Reply-To: larued@crpl.cedar-rapids.lib.ia.us
- NNTP-Posting-Host: ppp-109.cedar-rapids.lib.ia.us
- X-Newsreader: IBM NewsReader/2 v1.9d - NLS
-
- In <4eou36$p6g@prometheus.algonet.se>, bifrost@algonet.se (Nylund Patrik) writes:
- >How do I include argument from the commandline to the main function in
- >a c++ program?
- >
- >
-
- Nylund,
-
- The same as in C.
-
- === Example
-
- #include <iostream.h>
-
- int main (int argc, char *argv[])
- {
- int a;
-
- cout << "There are " << argc << " arguments.\n";
-
- for (a = 0; a < argc; ++a)
- {
- cout << "Argumnt " << argc << "is \"" << argv[a] << "\"\n");
- }
- }
-